/* 
 * File:   PsoOperators.h
 * Author: jcrada
 *
 * Created on April 8, 2009, 8:20 PM
 */

#ifndef _PSOOPERATORS_H
#define	_PSOOPERATORS_H

#include "PsoParticle.h"

namespace jcrada {

    class PsoModel;

    class PsoSharingMethod {
    public:

        PsoSharingMethod( ) {
        }

        virtual ~PsoSharingMethod( ) {
        }
        
        virtual void share( PsoModel& model ) = 0;
    };

    class PsoVelocityClampingMethod {
    public:

        virtual ~PsoVelocityClampingMethod( ) {
        }
        virtual void clamp( PsoParticle& particle ) = 0;

    };

    class PsoInertiaUpdateMethod {
    private:
        double _min_inertia;
        double _max_inertia;
    public:

        PsoInertiaUpdateMethod( double min_inertia = 0.4, double max_inertia = 0.9 ) :
        _min_inertia( min_inertia ),
        _max_inertia( max_inertia ) {
        }

        virtual ~PsoInertiaUpdateMethod( ) {
        }
        virtual void updateInertia( PsoParticle& particle, const PsoModel& model ) = 0;

        virtual double getMinInertia( ) const {
            return this->_min_inertia;
        }

        virtual void setMinInertia( double inertia ) {
            this->_min_inertia = inertia;
        }

        virtual double getMaxInertia( ) const {
            return this->_max_inertia;
        }

        virtual void setMaxInertia( double inertia ) {
            this->_max_inertia = inertia;
        }
    };
}


#endif	/* _PSOOPERATORS_H */

